<form action="{php echo web_url('halfcard/halfcode/editcode')}" method="post" class="form-horizontal form-validate">
	<div class="modal-dialog" style="z-index: 50;">
		<div class="modal-content">
			<div class="modal-header">
				<button data-dismiss="modal" class="close" type="button">×</button>
				<h4 class="modal-title">编辑激活码</h4>
			</div>
			<div class="modal-body" style="margin-left: 100px;">
				<div class="form-group">
					<label class="col-sm-2 control-label">激活时长</label>
					<div class="col-sm-7 col-xs-12">
						<div class="input-group">
							<input type="text" name="days" class="form-control" value="{$code['days']}" />
							<span class="input-group-addon">天</span>
						</div>
					</div>
				</div>
                {if file_exists(IA_ROOT . '/addons/'.MODULE_NAME.'/pTLjC21GjCGj.log')}
                    <!--某个用户定制的开通一卡通时赠送金额功能-->
                    <div class="form-group">
                        <label class="col-sm-2 control-label">赠送金额</label>
                        <div class="col-sm-7 col-xs-12">
                            <div class="input-group">
                                <input type="text" name="give_price" class="form-control" value="{$code['give_price']}" />
                                <span class="input-group-addon">￥</span>
                            </div>
                            <span class="help-block">用户使用当前激活码所赠送的金额</span>
                        </div>
                    </div>
                {/if}
				<div class="form-group">
					<label class="col-sm-2 control-label">适用代理</label>
					<div class="col-md-7">
						<select name="aid" style="width: 100%;">
							<option value="0" {if $code['aid'] == 0 || empty($code['aid'])} selected="selected" {/if} >全部代理</option>
							{loop $agents $agent}
							<option value="{$agent['id']}" {if $code['aid'] == $agent['id']} selected="selected" {/if} >{$agent['agentname']}</option>
							{/loop}
						</select>
					</div>
				</div>
				{if file_exists(PATH_MODULE . 'lsh.log')}
				<div class="form-group">
					<label class="col-sm-2 control-label">所属挪车代理</label>
					<div class="col-md-7">
						<select name="caraid" style="width: 100%;">
							<option value="0" {if $code['caraid'] == 0 || empty($code['caraid'])} selected="selected" {/if} >总平台</option>
							{loop $caragents $caragent}
							<option value="{$caragent['id']}" {if $code['caraid'] == $caragent['id']} selected="selected" {/if} >{$caragent['agentname']}</option>
							{/loop}
						</select>
					</div>
				</div>
				{/if}
				<div class="form-group">
					<label class="col-sm-2 control-label">会员等级</label>
					<div class="col-md-7">
						<select name="levelid" style="width: 100%;">
							<option value="0" {if $code['levelid'] == 0 || empty($code['levelid'])} selected="selected" {/if} >{$_W['wlsetting']['halflevel']['name']}</option>
							{loop $levels $level}
							<option value="{$level['id']}" {if $code['levelid'] == $level['id']} selected="selected" {/if} >{$level['name']}</option>
							{/loop}
						</select>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">修改备注</label>
					<div class="col-sm-7 col-xs-12">
						<div class="input-group" style="width: 100%;">
							<input type="text" name="remark" value="{$code['remark']}" class="form-control"/>
						</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">更新范围</label>
					<div class="col-sm-9">
						<label class="radio-inline">
							<input type="radio" value="0" name="range" checked="checked"> 仅此条
						</label>
						<label class="radio-inline">
							<input type="radio" value="1" name="range" > 同备注
						</label>
					</div>
				</div>
			</div>
			<div class="modal-footer">
				<input type="hidden" name="id" id="id" value="{$code['id']}" />
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="submit" class="btn btn-primary">提交更改</button>
			</div>
		</div>
	</div>
</form>
<script>
	$(document).on('show.bs.modal', '.modal', function(event) {
        $(this).appendTo($('body'));
    }).on('shown.bs.modal', '.modal.in', function(event) {
        setModalsAndBackdropsOrder();
    }).on('hidden.bs.modal', '.modal', function(event) {
        setModalsAndBackdropsOrder();
    });


    function setModalsAndBackdropsOrder() {  
        var modalZIndex = 1040;
        $('.modal.in').each(function(index) {
            var $modal = $(this);
            modalZIndex++;
            $modal.css('zIndex', modalZIndex);
            $modal.next('.modal-backdrop.in').addClass('hidden').css('zIndex', modalZIndex - 1);
        });
        $('.modal.in:visible:last').focus().next('.modal-backdrop.in').removeClass('hidden');
    }
</script>
